package com.lanbu.web.controller.system;

import java.util.List;
import com.lanbu.system.domain.dto.EmotionAnalysisDTO;
import com.lanbu.system.domain.vo.EmotionAnalysisResultsChartVo;
import com.lanbu.system.domain.vo.EmotionAnalysisResultsVo;
import com.lanbu.system.domain.vo.EmotionAnalysisResultsVoList;
import com.lanbu.system.domain.vo.ListAddressChart;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.lanbu.common.annotation.Log;
import com.lanbu.common.core.controller.BaseController;
import com.lanbu.common.core.domain.AjaxResult;
import com.lanbu.common.enums.BusinessType;
import com.lanbu.system.domain.EmotionAnalysisResults;
import com.lanbu.system.service.IEmotionAnalysisResultsService;
import com.lanbu.common.utils.poi.ExcelUtil;
import com.lanbu.common.core.page.TableDataInfo;

/**
 * 情绪分析结果Controller
 * 
 * @author lanbu
 * @date 2024-11-23
 */
@Api(tags = "情绪分析结果")
@RestController
@RequestMapping("/system/results")
public class EmotionAnalysisResultsController extends BaseController
{
    @Autowired
    private IEmotionAnalysisResultsService emotionAnalysisResultsService;

    /**
     * 查询情绪分析结果列表
     */
    @ApiOperation(value = "查询情绪分析结果列表")
    @PreAuthorize("@ss.hasPermi('system:results:list')")
    @GetMapping("/list")
    public TableDataInfo list(EmotionAnalysisDTO emotionAnalysisResults)
    {
        startPage();
        List<EmotionAnalysisResultsVoList> list = emotionAnalysisResultsService.selectEmotionAnalysisResultsList(emotionAnalysisResults);
        return getDataTable(list);
    }
    /**
     * 查询情绪分析结果列表
     */
    @ApiOperation(value = "查询情绪分析结果列表")
    @PreAuthorize("@ss.hasPermi('system:results:list')")
    @GetMapping("/listUnknown")
    public TableDataInfo listUnknown(EmotionAnalysisDTO emotionAnalysisResults)
    {
        startPage();
        List<EmotionAnalysisResultsVoList> list = emotionAnalysisResultsService.selectEmotionAnalysisResultsListUnknown(emotionAnalysisResults);
        return getDataTable(list);
    }


    /**
     * 查询情绪分析结果列表
     */
    @ApiOperation(value = "重点关注")
    @PreAuthorize("@ss.hasPermi('system:results:list')")
    @GetMapping("/listFocus")
    public TableDataInfo listFocus(EmotionAnalysisDTO emotionAnalysisResults)
    {
        startPage();
        List<EmotionAnalysisResultsVoList> list = emotionAnalysisResultsService.selectEmotionAnalysisResultsListFocus(emotionAnalysisResults);
        return getDataTable(list);
    }

    @ApiOperation(value = "查询情绪分析结果列表")
    @PreAuthorize("@ss.hasPermi('system:results:list')")
    @GetMapping("/listUser")
    public TableDataInfo listUser(EmotionAnalysisResultsVo emotionAnalysisResults)
    {
        startPage();
        List<EmotionAnalysisResultsVo> list = emotionAnalysisResultsService.selectEmotionAnalysisResultsListUser(emotionAnalysisResults);
        return getDataTable(list);
    }

    @ApiOperation(value = "查询情绪分析结果列表")
    @PreAuthorize("@ss.hasPermi('system:results:list')")
    @GetMapping("/listUserChart")
    public TableDataInfo listUserChart(EmotionAnalysisDTO emotionAnalysisDTO)
    {

        List<EmotionAnalysisResultsChartVo> list = emotionAnalysisResultsService.selectEmotionAnalysisResultsListUserChart(emotionAnalysisDTO);
        return getDataTable(list);
    }
    @ApiOperation(value = "查询情绪分析结果列表")
    @PreAuthorize("@ss.hasPermi('system:results:list')")
    @GetMapping("/listAddressChart")
    public TableDataInfo listAddressChart(EmotionAnalysisDTO emotionAnalysisDTO)
    {



        List<ListAddressChart> list = emotionAnalysisResultsService.selectEmotionAnalysisResultsListAddressChart(emotionAnalysisDTO);
        return getDataTable(list);
    }

    /**
     * 导出情绪分析结果列表
     */
    @ApiOperation(value = "导出情绪分析结果列表")
    @PreAuthorize("@ss.hasPermi('system:results:export')")
    @Log(title = "情绪分析结果", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EmotionAnalysisDTO emotionAnalysisResults)
    {
        List<EmotionAnalysisResultsVoList> list = emotionAnalysisResultsService.selectEmotionAnalysisResultsList(emotionAnalysisResults);
        ExcelUtil<EmotionAnalysisResultsVoList> util = new ExcelUtil<EmotionAnalysisResultsVoList>(EmotionAnalysisResultsVoList.class);
        util.exportExcel(response, list, "情绪分析结果数据");
    }

    /**
     * 获取情绪分析结果详细信息
     */
    @ApiOperation(value = "通过id获取情绪分析结果详细信息")
    @PreAuthorize("@ss.hasPermi('system:results:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(emotionAnalysisResultsService.selectEmotionAnalysisResultsById(id));
    }

    /**
     * 新增情绪分析结果
     */
    @ApiOperation(value = "新增情绪分析结果")
    @PreAuthorize("@ss.hasPermi('system:results:add')")
    @Log(title = "情绪分析结果", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EmotionAnalysisResults emotionAnalysisResults)
    {
        return toAjax(emotionAnalysisResultsService.insertEmotionAnalysisResults(emotionAnalysisResults));
    }

    /**
     * 修改情绪分析结果
     */
    @ApiOperation(value = "修改情绪分析结果")
    @PreAuthorize("@ss.hasPermi('system:results:edit')")
    @Log(title = "情绪分析结果", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EmotionAnalysisResults emotionAnalysisResults)
    {
        return toAjax(emotionAnalysisResultsService.updateEmotionAnalysisResults(emotionAnalysisResults));
    }

    /**
     * 删除情绪分析结果
     */
    @ApiOperation(value = "删除情绪分析结果")
    @PreAuthorize("@ss.hasPermi('system:results:remove')")
    @Log(title = "情绪分析结果", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable List<Long> ids)
    {
        return toAjax(emotionAnalysisResultsService.deleteEmotionAnalysisResultsByIds(ids));
    }
}
